@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row">
    	<div class="col-md-8 col-md-offset-2 ">
			<!-- Nav tabs -->
			<ul class="nav nav-tabs agent-flex" role="tablist">
			  <li role="presentation" class="active text-center"><a href="#home" role="tab" data-toggle="tab">经纪人</a></li>
			 <!--  <li role="presentation"><a href="#profile" role="tab" data-toggle="tab">二级(1)</a></li>
			  <li role="presentation"><a href="#messages" role="tab" data-toggle="tab">三级(1)</a></li> -->
			</ul>
			
			<!-- Tab panes -->
			<div class="tab-content">
			  <!--一级-->
			  <div role="tabpanel" class="tab-pane active" id="home">
			  		<div class="col-md-8 col-md-offset-2 ">
			  			@if(!empty($subordinates))
			  			@foreach($subordinates as $sub)
				  		<div class="panel panel-default">
				  			@if($sub->is_agent)
				  			 <div class="panel-jjr">{{ $sub->name }}<span class="right">经纪人</span></div>
			                
			                @else
			               <div class="panel-heading"> {{ $sub->name }}<span class="right"></span></div>
			                @endif
			                <div class="panel-body">
			                   <ul class="list-group" style="margin-bottom: 0;">
								  <li class="list-group-item clearfix">
								  	<span class="left">注册时间</span>
								  	<span class="right">{{ $sub->created_at }}</span>
								  </li>
								  <li class="list-group-item clearfix">
								  	<span class="left">联系电话</span>
								  	<span class="right">{{ $sub->mobile }}</span>
								  </li>
								  <li class="list-group-item clearfix">
								  	<span class="left">佣金收入</span>
								  	<span class="right">￥{{ $sub->commissions()->count() }}</span>
								  </li>
								</ul> 
			                </div>
			            </div>
			            @endforeach
			            
			            @else
			            <div class="panel panel-default">
			            	<div class="panel-heading">提示</div>
			            	<div class="panel-body">你还没有下级</div>
			            </div>
			            @endif
		            </div>
		           
			  </div>
			   <!--二级-->
			  <!--<div role="tabpanel" class="tab-pane" id="profile">..Profile</div>-->
			   <!--三级-->
			  <!--<div role="tabpanel" class="tab-pane" id="messages">.Messages.</div>-->
			</div>

    	</div>

    </div>
    {!! $subordinates->render() !!}
</div>
@endsection
